using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ERPBackend.Models
{
    public class SecondLevelCategory : BaseModel
    {
        [Required]
        public int FirstLevelCategoryId { get; set; }

        [ForeignKey("FirstLevelCategoryId")]
        public FirstLevelCategory? FirstLevelCategory { get; set; }

        [Required]
        [StringLength(50)]
        public string CategoryCode { get; set; } = string.Empty;

        [Required]
        [StringLength(255)]
        public string CategoryName { get; set; } = string.Empty;

        public string? MaterialDescription { get; set; }

        [StringLength(50)]
        public string? Unit { get; set; }

        public int? SafetyStock { get; set; }

        [Required]
        [Range(0, 1)]
        public byte Status { get; set; } = 1;

        // Navigation property for materials
        public ICollection<Material> Materials { get; set; } = new List<Material>();
    }
}